package com.zy.stock.controller;

import annotation.SwaggerMapping;
import client.BaseStockController;

import com.zy.stock.domain.Stocks;
import com.zy.stock.mapper.StocksMapper;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author 这是那头猪？
 * @version 1.0
 * @description: TODO
 * @date 2023/5/31 10:17
 */

@SwaggerMapping
@RestController
public class StockController implements BaseStockController {
    @Resource
    private StocksMapper stocksMapper;

    @Override
    public String hello() {
        Stocks stocks = stocksMapper.selectById(1);
        stocks.setQuantity(stocks.getQuantity()-1);
        int i = stocksMapper.updateById(stocks);
        return i != 1 ? "下单失败" : "下单成功";
    }
}
